<template>
  <div class="app-container">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="开启短信">
            <el-radio v-model="form.sms_tengxunyun_enable" :label="1">开启</el-radio>
            <el-radio v-model="form.sms_tengxunyun_enable" :label="2">关闭</el-radio>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="签名名称">
            <el-input v-model="form.sms_tengxunyun_sign_name" style="width: 200px;"/>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="appId">
            <el-input v-model="form.sms_tengxunyun_app_id" style="width: 200px;"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="appSecretId">
              <el-input v-model="form.sms_tengxunyun_app_secret_id" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="appSecretKey">
              <el-input v-model="form.sms_tengxunyun_app_secret_key" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="登录注册模板01">
              <el-input v-model="form.sms_tengxunyun_templateId_01" style="width: 300px;" />
            </el-form-item>
          </el-col>
          
          <el-col :span="12">
            <el-form-item label="重置密码模板02">
              <el-input v-model="form.sms_tengxunyun_templateId_02" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="买回码模板03">
              <el-input v-model="form.sms_tengxunyun_templateId_03" style="width: 300px;" />
            </el-form-item>
          </el-col>
          
          <el-col :span="12">
            <el-form-item label="客户申请模板04">
              <el-input v-model="form.sms_tengxunyun_templateId_04" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="延期成功模板05">
              <el-input v-model="form.sms_tengxunyun_templateId_05" style="width: 300px;" />
            </el-form-item>
          </el-col>
          
          <el-col :span="12">
            <el-form-item label="订单逾期模板06">
              <el-input v-model="form.sms_tengxunyun_templateId_06" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="订单到期模板07">
              <el-input v-model="form.sms_tengxunyun_templateId_07" style="width: 300px;" />
            </el-form-item>
          </el-col>
          
          <el-col :span="12">
            <el-form-item label="订单完成模板08">
              <el-input v-model="form.sms_tengxunyun_templateId_08" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="订单物流模板09">
              <el-input v-model="form.sms_tengxunyun_templateId_09" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="订单创建成功10">
              <el-input v-model="form.sms_tengxunyun_templateId_10" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="客服转单提醒模板11">
              <el-input v-model="form.sms_tengxunyun_templateId_11" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同创建提醒模版12">
              <el-input v-model="form.sms_tengxunyun_templateId_12" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="注册成功后模板13">
              <el-input v-model="form.sms_tengxunyun_templateId_13" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="未使用提醒模版14">
              <el-input v-model="form.sms_tengxunyun_templateId_14" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="注册成功短信提醒15">
              <el-input v-model="form.sms_tengxunyun_templateId_15" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="注册后长期未使用16">
              <el-input v-model="form.sms_tengxunyun_templateId_16" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="管理员支付成功17">
              <el-input v-model="form.sms_tengxunyun_templateId_17" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="管理员退款通知18">
              <el-input v-model="form.sms_tengxunyun_templateId_18" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="商家拒绝退款19">
              <el-input v-model="form.sms_tengxunyun_templateId_19" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="商家同意退款20">
              <el-input v-model="form.sms_tengxunyun_templateId_20" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="退款确认提醒21">
              <el-input v-model="form.sms_tengxunyun_templateId_21" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="管理员退货提醒22">
              <el-input v-model="form.sms_tengxunyun_templateId_22" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="推广营销短信23">
              <el-input v-model="form.sms_tengxunyun_templateId_23" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="加盟商加入提醒24">
              <el-input v-model="form.sms_tengxunyun_templateId_24" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="买回中提醒处理25">
              <el-input v-model="form.sms_tengxunyun_templateId_25" style="width: 300px;" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="意向单申请验证26">
              <el-input v-model="form.sms_tengxunyun_templateId_26" style="width: 300px;" />
            </el-form-item>
          </el-col>
      </el-row>
      <el-row>
          <el-col :span="12">
            <el-form-item label="签合同未签单提醒27">
              <el-input v-model="form.sms_tengxunyun_templateId_27" style="width: 300px;" />
            </el-form-item>
          </el-col>
        
      </el-row>
      
      <el-form-item label="">
        <el-button type="primary" @click="doSubmit">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/crud'
import { del, add, get } from '@/api/yxSystemConfig'
import eForm from './form'
import picUpload from '@/components/pic-upload'
import { Message } from 'element-ui'
export default {
  components: { eForm, picUpload },
  mixins: [initData],
  data() {
    return {
      delLoading: false,
      form: {
        sms_tengxunyun_sign_name:'',
        sms_tengxunyun_enable: 2,
        sms_tengxunyun_app_id: '',
        sms_tengxunyun_app_secret_id: '',
        sms_tengxunyun_app_secret_key: '',
        sms_tengxunyun_templateId_01: '',
        sms_tengxunyun_templateId_02: '',
        sms_tengxunyun_templateId_03: '',
        sms_tengxunyun_templateId_04: '',
        sms_tengxunyun_templateId_05: '',
        sms_tengxunyun_templateId_06: '',
        sms_tengxunyun_templateId_07: '',
        sms_tengxunyun_templateId_08: '',
        sms_tengxunyun_templateId_09:'',
        sms_tengxunyun_templateId_10:'',
        sms_tengxunyun_templateId_11:'',
        sms_tengxunyun_templateId_12:'',
        sms_tengxunyun_templateId_13:'',
        sms_tengxunyun_templateId_14:'',
        sms_tengxunyun_templateId_15:'',
        sms_tengxunyun_templateId_16:'',
        sms_tengxunyun_templateId_17:'',
        sms_tengxunyun_templateId_18:'',
        sms_tengxunyun_templateId_19:'',
        sms_tengxunyun_templateId_20:'',
        sms_tengxunyun_templateId_21:'',
        sms_tengxunyun_templateId_22:'',
        sms_tengxunyun_templateId_23:'',
        sms_tengxunyun_templateId_24:'',
        sms_tengxunyun_templateId_25:'',
        sms_tengxunyun_templateId_26:'',
        sms_tengxunyun_templateId_27:'',
      },
      rules: {
      }
    }
  },
  created() {
    get().then(rese => {
      const that = this;
      rese.content.map(function(key, value) {
        const keyName = key.menuName
        const newValue = key.value
        if(keyName in that.form){
          that.form[keyName] = newValue
        }
      })

      this.form.sms_tengxunyun_enable = parseInt(this.form.sms_tengxunyun_enable)
    })
  },
  methods: {
    checkPermission,
    doSubmit() {
      add(this.form).then(res => {
        Message({ message: '设置成功', type: 'success' })
      }).catch(err => {
        // this.loading = false
        console.log(err.response.data.message)
      })
    }

  }
}
</script>

<style scoped>

</style>
